package com.snowy.hidden.user.controller;


import com.snowy.framework.common.resp.BaseResp;
import com.snowy.framework.common.resp.BaseRespUtil;
import com.snowy.hidden.interceptor.IgnoreAuth;
import com.snowy.hidden.user.domain.dto.AppInfoDTO;
import com.snowy.hidden.user.service.AppInfoService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * APP版本管理(AppInfo)表控制层
 *
 * @author chenli
 * @since 2022-01-08 20:07:01
 */
@RestController
@RequestMapping("/appInfo")
public class AppInfoController {
    /**
     * 服务对象
     */
    @Resource
    private AppInfoService appInfoService;

    @IgnoreAuth
    @ApiOperation("获取版本号")
    @GetMapping(value = "/getVersionName/{type}")
    public BaseResp<AppInfoDTO> getVersionName(@PathVariable("type") Integer type) {
        try {
            AppInfoDTO appInfoDTO= appInfoService.getVersionName(type);
            return BaseRespUtil.Success(appInfoDTO);
        } catch (Exception e) {
            return BaseRespUtil.Error(e);
        }
    }

}
